Skip to content

Comments

[Core] Fix format_url to allow leading slash if specified#45218

Merged
pvaneck merged 1 commit intoAzure:mainfrom
pvaneck:core-format-url-fix
Feb 17, 2026
Merged

[Core] Fix format_url to allow leading slash if specified#45218
pvaneck merged 1 commit intoAzure:mainfrom
pvaneck:core-format-url-fix

Conversation

@pvaneck
Copy link
Member

@pvaneck pvaneck commented Feb 17, 2026

The previous adjustment to format_url of always removing the trailing slash was too aggressive as some scenarios depend on a slash before the query parameters.

Reverting tables test changes with the addition of this fix.

The previous adjustment to `format_url` of always removing the trailing
slash was too aggressive as some scenarios depend on a slash before the
query parameters.

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
@pvaneck pvaneck force-pushed the core-format-url-fix branch from 7c19b8d to 4f5e007 Compare February 17, 2026 19:49
@pvaneck
Copy link
Member Author

pvaneck commented Feb 17, 2026

Did some manual live test runs, and they appear fine (the failures are pre-existing/flakiness).

Other pipeline failures are attributed to an unrelated mindependency conflict in azure-communication-identity

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression in PipelineClient.format_url where leading slashes before query parameters were being incorrectly stripped. The previous fix in version 1.38.1 that removed trailing slashes when URL templates contained only query parameters was too aggressive and broke scenarios where a leading slash before query parameters was intentional (e.g., "/?restype=service&comp=properties").

Changes:

  • Fixed _urljoin to strip leading slashes from paths during joining (avoiding double slashes) instead of stripping them in format_url
  • Reverted Azure Tables test workarounds that were added to handle the incorrect URL formatting behavior
  • Added comprehensive test coverage for various URL formatting scenarios with query strings

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sdk/core/azure-core/azure/core/pipeline/transport/_base.py Moved leading slash stripping from format_url to _urljoin to preserve intentional leading slashes before query parameters
sdk/core/azure-core/tests/test_pipeline.py Added tests for format_url with various query string patterns and HttpRequest objects
sdk/core/azure-core/tests/test_basic_transport.py Extended _urljoin tests to cover leading slash handling and query parameter scenarios
sdk/tables/azure-data-tables/tests/test_table_service_properties.py Removed version check workaround and unused imports, restoring original test expectations
sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py Removed version check workaround and unused imports, restoring original test expectations
sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos.py Removed version check conditional that was working around the URL formatting bug
sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos_async.py Removed version check conditional and unused imports
sdk/tables/azure-data-tables/assets.json Updated test recording assets reference to reflect re-recorded tests
sdk/core/azure-core/CHANGELOG.md Added bug fix entry for the leading slash preservation fix

@pvaneck pvaneck marked this pull request as ready for review February 17, 2026 20:58
Copy link
Member

@lmazuel lmazuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick look seems valid, thanks!

@pvaneck
Copy link
Member Author

pvaneck commented Feb 17, 2026

/check-enforcer override

@pvaneck pvaneck merged commit b5f8d70 into Azure:main Feb 17, 2026
59 of 65 checks passed
@pvaneck pvaneck deleted the core-format-url-fix branch February 17, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants